import 'package:xvideos/hj_model/actress_info.dart';

class ActressModel {
  ActressModel({
    this.hasFollow,
    this.info,
  });

  ActressModel.fromJson(dynamic json) {
    hasFollow = json['hasFollow'];
    if (json['info'] != null) {
      info = ActressInfo.fromJson(json['info']);
    }
    if (json['desc'] is List) {
      desc = (json['desc'] as List).map((e) => e.toString()).toList();
    }
  }

  bool? hasFollow;
  ActressInfo? info;
  List<String>? desc;
}

class ActressFilterResp {
  List<ActressFilterModel>? list;

  Map<String, dynamic>? get selectedMap {
    Map<String, dynamic> paramInfo = {};
    for (ActressFilterModel model in (list ?? [])) {
      if (model.selectOption != null) {
        paramInfo[model.paramValue ?? ""] = model.selectOption?.optionValue ?? "";
      }
    }
    if (paramInfo.isNotEmpty) {
      return paramInfo;
    } else {
      return null;
    }
  }

  ActressFilterResp.fromJson(dynamic json) {
    if (json['list'] is List) {
      list = (json['list'] as List).map((e) => ActressFilterModel.fromJson(e)).toList();
    }
  }
}

class ActressFilterModel {
  String? paramName;
  String? paramValue;
  List<ActressOptionModel>? options;
  ActressOptionModel? selectOption; // 选择的值
  ActressFilterModel({this.paramName, this.paramValue, this.options});
  ActressFilterModel.fromJson(dynamic json) {
    if (json is Map) {
      paramName = json['paramName'];
      paramValue = json['paramValue'];
      if (json['options'] is List) {
        options = (json['options'] as List).map((e) => ActressOptionModel.fromJson(e)).toList();
      }
    }
  }

  static ActressFilterModel get sortFilterModel {
    var model = ActressFilterModel();
    model.paramName = "排序";
    model.paramValue = "sortType";
    model.options = [
      ActressOptionModel(optionName: "热门推荐", optionValue: 0),
      ActressOptionModel(optionName: "最多片量", optionValue: 1),
      ActressOptionModel(optionName: "最高人气", optionValue: 2),
    ];
    return model;
  }
}

class ActressOptionModel {
  String? optionName;
  dynamic optionValue;
  ActressOptionModel({this.optionName, this.optionValue});
  ActressOptionModel.fromJson(dynamic json) {
    if (json is Map) {
      optionName = json['optionName'];
      optionValue = json['optionValue'];
    }
  }
}
